from django.contrib.auth.models import User
from rest_framework import viewsets
from  .serializers import UserSerializer
from rest_framework.pagination import PageNumberPagination

class UserViewSet(viewsets.ModelViewSet):
    '''
    retireve:
        获取指定user记录
    list:
        获取user列表
    update:
        更新IDC记录
    particial_update:
        更新user部分字段
    destroy:
        删除user记录
    create:
        新增user记录
    '''
    queryset = User.objects.all()
    serializer_class = UserSerializer
    pagination_class = PageNumberPagination
    pagination_class.page_query_param = "p"
    # 自定义分页
    pagination_class.page_size_query_param = "page_size"